<include file="Public/header" title="更新房源分身" />
<div id="page-wrapper">
    <form method="post" action="{:U('Fenrent/update',array('id'=>$fenrent['id']))}"  enctype="multipart/form-data">
        <h2>基本信息</h2>
    <!-- 房间号 -->
        <div class="form-group  row">
            <label class="col-sm-1">房间号</label>
			 <div class="col-sm-11">
            <input type="hidden" name="fanghao" placeholder="房间号" value="{$fenrent['fanghao']}" />{$fenrent['fanghao']}
            </div> 
		</div> 
    <!-- 房间面积 -->
        <div class="form-group  row">
            <label class="col-sm-1">房间面积</label>
			 <div class="col-sm-11">
            <input type="text" name="mianji" placeholder="房间面积" value="{$fenrent['mianji']}" class="form-control"  />
            </div> 
		</div> 
    <!-- 房间价格 -->
        <div class="form-group  row">
            <label class="col-sm-1">房间价格</label>
			 <div class="col-sm-11">
            <input type="text" name="jiage" placeholder="房间价格" value="{$fenrent['jiage']}" class="form-control"  />
            </div> 
		</div> 	
		
    <!-- 性别 -->
        <div class="form-group row">
            <label class="col-sm-1">性别</label>
            <div class="col-sm-11">
			<if condition="$fenrent['xingbie'] eq '男' " >
            <input type="radio" name="xingbie" value="男" style="display:inline-block;margin-left:20px;" checked="checked" />男
			<else />
            <input type="radio" name="xingbie" value="男" style="display:inline-block;margin-left:20px;" />男
			</if>
			
			<if condition="$fenrent['xingbie'] eq '女' " >
            <input type="radio" name="xingbie" value="女" style="display:inline-block;margin-left:20px;" checked="checked" />女
			<else />
            <input type="radio" name="xingbie" value="女" style="display:inline-block;margin-left:20px;" />女
			</if>
			<if condition="$fenrent['xingbie'] eq '无' " >
            <input type="radio" name="xingbie" value="无" style="display:inline-block;margin-left:20px;" checked="checked" />无
			<else />
            <input type="radio" name="xingbie" value="无" style="display:inline-block;margin-left:20px;" />无
			</if>                      
            </div>
        </div>
		
		
    <!-- 星座 -->
        <div class="form-group row">
            <label class="col-sm-1">星座</label>
            <div class="col-sm-11">
			<if condition="$fenrent['xingzuo'] eq '白羊座' " >
            <input type="radio" name="xingzuo" value="白羊座" style="display:inline-block;margin-left:20px;" checked="checked" />白羊座
			<else />
            <input type="radio" name="xingzuo" value="白羊座" style="display:inline-block;margin-left:20px;" />白羊座
			</if>
			<if condition="$fenrent['xingzuo'] eq '金牛座' " >
            <input type="radio" name="xingzuo" value="金牛座" style="display:inline-block;margin-left:20px;" checked="checked" />金牛座
			<else />
            <input type="radio" name="xingzuo" value="金牛座" style="display:inline-block;margin-left:20px;" />金牛座
			</if>
			<if condition="$fenrent['xingzuo'] eq '双子座' " >
            <input type="radio" name="xingzuo" value="双子座" style="display:inline-block;margin-left:20px;" checked="checked" />双子座
			<else />
            <input type="radio" name="xingzuo" value="双子座" style="display:inline-block;margin-left:20px;" />双子座
			</if>
			<if condition="$fenrent['xingzuo'] eq '巨蟹座' " >
            <input type="radio" name="xingzuo" value="巨蟹座" style="display:inline-block;margin-left:20px;" checked="checked" />巨蟹座
			<else />
            <input type="radio" name="xingzuo" value="巨蟹座" style="display:inline-block;margin-left:20px;" />巨蟹座
			</if>
			<if condition="$fenrent['xingzuo'] eq '狮子座' " >
            <input type="radio" name="xingzuo" value="狮子座" style="display:inline-block;margin-left:20px;" checked="checked" />狮子座
			<else />
            <input type="radio" name="xingzuo" value="狮子座" style="display:inline-block;margin-left:20px;" />狮子座
			</if>
			<if condition="$fenrent['xingzuo'] eq '处女座' " >
            <input type="radio" name="xingzuo" value="处女座" style="display:inline-block;margin-left:20px;" checked="checked" />处女座
			<else />
            <input type="radio" name="xingzuo" value="处女座" style="display:inline-block;margin-left:20px;" />处女座
			</if>
			<if condition="$fenrent['xingzuo'] eq '天秤座' " >
            <input type="radio" name="xingzuo" value="天秤座" style="display:inline-block;margin-left:20px;" checked="checked" />天秤座
			<else />
            <input type="radio" name="xingzuo" value="天秤座" style="display:inline-block;margin-left:20px;" />天秤座
			</if>
			<if condition="$fenrent['xingzuo'] eq '天蝎座' " >
            <input type="radio" name="xingzuo" value="天蝎座" style="display:inline-block;margin-left:20px;" checked="checked" />天蝎座
			<else />
            <input type="radio" name="xingzuo" value="天蝎座" style="display:inline-block;margin-left:20px;" />天蝎座
			</if>
			<if condition="$fenrent['xingzuo'] eq '射手座' " >
            <input type="radio" name="xingzuo" value="射手座" style="display:inline-block;margin-left:20px;" checked="checked" />射手座
			<else />
            <input type="radio" name="xingzuo" value="射手座" style="display:inline-block;margin-left:20px;" />射手座
			</if>
			<if condition="$fenrent['xingzuo'] eq '摩羯座' " >
            <input type="radio" name="xingzuo" value="摩羯座" style="display:inline-block;margin-left:20px;" checked="checked" />摩羯座
			<else />
            <input type="radio" name="xingzuo" value="摩羯座" style="display:inline-block;margin-left:20px;" />摩羯座
			</if>
			<if condition="$fenrent['xingzuo'] eq '水瓶座' " >
            <input type="radio" name="xingzuo" value="水瓶座" style="display:inline-block;margin-left:20px;" checked="checked" />水瓶座
			<else />
            <input type="radio" name="xingzuo" value="水瓶座" style="display:inline-block;margin-left:20px;" />水瓶座
			</if>
			<if condition="$fenrent['xingzuo'] eq '双鱼座' " >
            <input type="radio" name="xingzuo" value="双鱼座" style="display:inline-block;margin-left:20px;" checked="checked" />双鱼座
			<else />
            <input type="radio" name="xingzuo" value="双鱼座" style="display:inline-block;margin-left:20px;" />双鱼座
			</if>                  
            </div>
        </div> 
		
    <!-- 职业 -->
        <div class="form-group  row">
            <label class="col-sm-1">职业</label>
			 <div class="col-sm-11">
            <input type="text" name="zhiye" placeholder="职业" value="{$fenrent['zhiye']}" class="form-control"  />
            </div> 
		</div> 
    <!-- 入住时间 -->
        <div class="form-group  row">
            <label class="col-sm-1">入住时间</label>
			 <div class="col-sm-11">
            <input type="text" name="shijian" placeholder="入住时间" value="{$fenrent['shijian']}" class="form-control"  />
            </div> 
		</div> 
		
    <!-- 飘窗 -->
        <div class="form-group row">
            <label class="col-sm-1">飘窗</label>
            <div class="col-sm-11">
			<if condition="$fenrent['piaochuang'] eq '有' " >
            <input type="radio" name="piaochuang" value="有" style="display:inline-block;margin-left:20px;" checked="checked" />有
			<else />
            <input type="radio" name="piaochuang" value="有" style="display:inline-block;margin-left:20px;" />有
			</if> 
			<if condition="$fenrent['piaochuang'] eq '无' " >
            <input type="radio" name="piaochuang" value="无" style="display:inline-block;margin-left:20px;" checked="checked" />无
			<else />
            <input type="radio" name="piaochuang" value="无" style="display:inline-block;margin-left:20px;" />无
			</if>         
            </div>
        </div> 
    <!-- 空调 -->
        <div class="form-group row">
            <label class="col-sm-1">空调</label>
            <div class="col-sm-11">
			<if condition="$fenrent['kongtiao'] eq '有' " >
            <input type="radio" name="kongtiao" value="有" style="display:inline-block;margin-left:20px;" checked="checked" />有
			<else />
            <input type="radio" name="kongtiao" value="有" style="display:inline-block;margin-left:20px;" />有
			</if> 
			<if condition="$fenrent['kongtiao'] eq '无' " >
            <input type="radio" name="kongtiao" value="无" style="display:inline-block;margin-left:20px;" checked="checked" />无
			<else />
            <input type="radio" name="kongtiao" value="无" style="display:inline-block;margin-left:20px;" />无
			</if>         
            </div>
        </div>
		 
    <!-- 人数 -->
        <div class="form-group row">
            <label class="col-sm-1">入住人数</label>
            <div class="col-sm-11">
			<if condition="$fenrent['renshu'] eq '一人' " >
            <input type="radio" name="renshu" value="一人" style="display:inline-block;margin-left:20px;" checked="checked" />一人
			<else />
            <input type="radio" name="renshu" value="一人" style="display:inline-block;margin-left:20px;" />一人
			</if> 
			<if condition="$fenrent['renshu'] eq '两人' " >
            <input type="radio" name="renshu" value="两人" style="display:inline-block;margin-left:20px;" checked="checked" />两人
			<else />
            <input type="radio" name="renshu" value="两人" style="display:inline-block;margin-left:20px;" />两人
			</if> 
			<if condition="$fenrent['renshu'] eq '多人' " >
            <input type="radio" name="renshu" value="多人" style="display:inline-block;margin-left:20px;" checked="checked" />多人
			<else />
            <input type="radio" name="renshu" value="多人" style="display:inline-block;margin-left:20px;" />多人
			</if> 
			<if condition="$fenrent['renshu'] eq '无人' " >
            <input type="radio" name="renshu" value="无人" style="display:inline-block;margin-left:20px;" checked="checked" />无人
			<else />
            <input type="radio" name="renshu" value="无人" style="display:inline-block;margin-left:20px;" />无人
			</if>   
            </div>
        </div>
		
    <!-- 卫生间 -->
        <div class="form-group row">
            <label class="col-sm-1">卫生间</label>
            <div class="col-sm-11">
			<if condition="$fenrent['wcroom'] eq '有' " >
            <input type="radio" name="wcroom" value="有" style="display:inline-block;margin-left:20px;" checked="checked" />有
			<else />
            <input type="radio" name="wcroom" value="有" style="display:inline-block;margin-left:20px;" />有
			</if> 
			<if condition="$fenrent['wcroom'] eq '无' " >
            <input type="radio" name="wcroom" value="无" style="display:inline-block;margin-left:20px;" checked="checked" />无
			<else />
            <input type="radio" name="wcroom" value="无" style="display:inline-block;margin-left:20px;" />无
			</if> 
            </div>
        </div>
    <!-- 入住状态 -->
        <div class="form-group row">
            <label class="col-sm-1">入住状态</label>
            <div class="col-sm-11">
			<if condition="$fenrent['state'] eq 0 " >
            <input type="radio" name="state" value="0" style="display:inline-block;margin-left:20px;" checked="checked" />未入住
			<else />
            <input type="radio" name="state" value="0" style="display:inline-block;margin-left:20px;" />未入住
			</if> 
			<if condition="$fenrent['state'] eq 1 " >
            <input type="radio" name="state" value="1" style="display:inline-block;margin-left:20px;" checked="checked" />已入住      
			<else />
            <input type="radio" name="state" value="1" style="display:inline-block;margin-left:20px;" />已入住      
			</if> 
            </div>
        </div>

      <style>
      div.imglist{ margin:0 auto; width:90%;margin-left:160px; overflow:hidden; z-index:9999999;} 
      div.imglist div{ float:left; margin:4px;padding:2px; width:160px; background-color:#dbdbdb;list-style-type: none; position:relative;} 
      div.imglist div img{ display:block; width:156px; height:156px;} 
      div.imglist div span{ position:absolute;top:2px;right:2px; display:block; width:30px; height:30px; line-height:30px; background:url("Public/images/cha.png") no-repeat;} 
      </style>		
    <!-- 房间图片 -->
        <div class="form-group row">
            <label class="col-sm-1">房间图片</label>
            <div class="col-sm-11">
           <input type="file" name="pic[]" class="form-control" >
            </div>
        </div>
        <div class="form-group row">
		<div class="imglist"> 
        <?php
        $items=$fenrent['imgurl'];  
        $arr = explode("|",$items);
        for($i=0;$i<count($arr)-1;$i++){
        echo "<div class='del' data-url='$arr[$i]'><img src='Public/$arr[$i]'  alt=''/><span></span></div>";
        }
        ?>
		</div>
        </div>
 
  <button type="submit" class="btn btn-default">提交</button>
    </form>
</div>
<include file="Public/footer" />
<script type="text/javascript">
$(function(){
    $(".del").click(function(){
         var delurl = $(this).data("url");
		 $(this).remove();
         var id = GetQueryString("id");
         $.ajax({
            type:"POST",
            url:"{:U('Admin/Fenrent/delarr')}",
            data:{
                id:id,
                url:delurl
            },
            success:function(data){
                
            },
            error:function(){
                alert("error");
            }
         })
    });
});

function GetQueryString(name){
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}
</script>